<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>6.将用户输入的网址全部转化成我们的官网。如www.baidu.com=>www.lagou.com</title>
</head>
<body>
    <script>
        let url = "www.baidu.com";
        let reg = /[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/;
        let new_url = url.replace(reg,"www.lagou.com");
        console.log(new_url);
    </script>
</body>
</html>